﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BTCairo
{
    public class Ellipse : Shape
    {
        int x, y, width, height;
        BasicShape ellipse;
        public Ellipse(CommonGraphics _comgra, int _x, int _y, int _w, int _h)
        {
            myCommonGraphic = _comgra;
            myCommonGraphic.MyInfoGraphic.x = _x;
            myCommonGraphic.MyInfoGraphic.y = _y;
            myCommonGraphic.MyInfoGraphic.widthShape = _w;
            myCommonGraphic.MyInfoGraphic.heightShape = _h;
            x = _x;
            y = _y;
            width = _w;
            height = _h;
            
        }
        public override InfoGraphic getInfoShape()
        {
            InfoGraphic info = myCommonGraphic.MyInfoGraphic;
            info.x = x;
            info.y = y;
            info.widthShape = width;
            info.heightShape = height;
            return info;
        }
        public override Shape CloneShape()
        {
            Ellipse temp = new Ellipse(myCommonGraphic.CloneCommonGraphic(), x, y, width, height);
            return temp;
        }
        public override Shape CloneShape(int plusX, int plusY)
        {
            Ellipse temp = new Ellipse(myCommonGraphic.CloneCommonGraphic(), x+plusX, y+plusY, width, height);
            return temp;
        }

        public override void Draw()
        {
            if (shadow != null)
                shadow.DoEffect(this);
            if (highlight != null)
                highlight.DoEffect(this);
            if (border != null)
                border.DoEffect(this);
            ellipse = new BasicEllipse(myCommonGraphic, x, y, width, height);
            ellipse.Draw();
        }
        public override void DrawEffect()
        {
            ellipse = new BasicEllipse(myCommonGraphic);
            ellipse.Draw();
        }

        //public override string ToString()
        //{
        //    return ellipse.ToString();
        //}

        public override void ParseXmlElement(System.Xml.XmlDocument doc, System.Xml.XmlElement root)
        {
            if (shadow != null)
                shadow.ParseXmlElement(doc, root);
            if (highlight != null)
                highlight.ParseXmlElement(doc, root);
            if (border != null)
                border.ParseXmlElement(doc, root);
            ellipse.ParseXmlElement(doc, root);
        }
    }
}
